package com.dianxin.smartpark.web.park;

import java.util.List;

import cn.dev33.satoken.annotation.SaCheckPermission;
import com.chinatelecom.response.common.CommonResponseBody;
import com.dianxin.smartpark.dao.qo.park.SmartParkCarParkQO;
import com.dianxin.smartpark.service.park.SmartParkCarParkService;
import com.dianxin.smartpark.service.vo.park.SmartParkCarParkVO;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * 停车场
 * 
 * @author chenjiasong
 * @date 2021-07-28
 */
@RestController
@RequestMapping("/smartpark/park")
public class SmartParkCarParkController
{
    @Resource
    private SmartParkCarParkService smartParkCarParkService;

    /**
     * 查询停车场列表
     */
    @GetMapping("/list")
    @SaCheckPermission(value = "/smartpark/park/list")
    public CommonResponseBody<List<SmartParkCarParkVO>>  list(SmartParkCarParkQO qo)
    {
        return smartParkCarParkService.selectSmartParkCarParkList(qo);
    }


    /**
     * 获取停车场详细信息
     */
    @GetMapping(value = "/getInfo")
    @SaCheckPermission(value = "/smartpark/park/getInfo")
    public CommonResponseBody<SmartParkCarParkVO> getInfo(SmartParkCarParkQO qo)
    {
        return smartParkCarParkService.selectSmartParkCarPark(qo);
    }

    /**
     * 新增停车场
     */
    @PostMapping("/add")
    @SaCheckPermission(value = "/smartpark/park/add")
    public  CommonResponseBody<Boolean> add(@RequestBody SmartParkCarParkVO vo)
    {
        return smartParkCarParkService.insertSmartParkCarPark(vo);
    }

    /**
     * 修改停车场
     */
    @PutMapping("/edit")
    @SaCheckPermission(value = "/smartpark/park/edit")
    public  CommonResponseBody<Boolean> edit(@RequestBody SmartParkCarParkVO vo)
    {
        return smartParkCarParkService.updateSmartParkCarPark(vo);
    }

    /**
     * 删除停车场
     */
	@DeleteMapping("/remove")
    @SaCheckPermission(value = "/smartpark/park/remove")
    public  CommonResponseBody<Boolean> remove(@RequestBody SmartParkCarParkVO vo)
    {
        return smartParkCarParkService.deleteSmartParkCarPark(vo);
    }
}
